<script>
    $(document).ready(function() {
        $("#contentDetail").append('<br/>');
    });
</script>
<style>
    #form-top p {
        height: 35px;
        float: none;
        display: block;
        margin-right: 15px;
    }
</style>
<!--<div id="form-top">-->
<div class="onecolumn" style="height: 700px;">
    <div class="header">
        <span style="color: red; text-align: center; font-weight: bold;">Đăng bài viết mới</span>
    </div>
    <br class="clear"/>
    <div id="form-top">
        <?php
        $form = $this->form;
        $form->setAttribute('enctype', 'multipart/form-data');
        $form->setAttribute('action', $this->url('article-management/default', array('action' => 'newArticle')));
        $form->prepare();
        echo $this->form()->openTag($form);
        echo $this->formHidden($form->get('articleID'));
        ?>
        <fieldset>
            <legend>Nội dung bài viết</legend>                   
            <p>

                <?php
                echo $this->formLabel($form->get('title'));
                echo $this->formInput($form->get('title'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('subCategoryID'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('isPublisher'));
                echo $this->formSelect($form->get('isPublisher'));
                ?>
            </p>

            <p>
                <?php
                echo $this->formLabel($form->get('dateCreated'));
                echo $this->formInput($form->get('dateCreated'));
                ?>
            </p>
            <script>
                $("#dateCreated").datepicker({
                    nextText: '&raquo;',
                    prevText: '&laquo;',
                    showAnim: 'slideDown',
                    dateFormat: 'dd-mm-yy'
                });
            </script>
            <p style="margin-bottom: 60px;">
                <?php
                echo $this->formRow($form->get('description'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('pictureThumnail'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('contentDetail'));
                ?>
            </p>
            <script>
                CKEDITOR.replace('contentDetail', {
                    fullpage: true,
                    height: 180,
                    width: 900,
                    extraPlugins: 'docprops',
                    skin: 'office2003'
                });
            </script>

            <div style="width: 100%;margin:  300px auto 10px 500px;">
                <?php
                echo $this->formInput($form->get('addNew'));
                ?>
                <input style="margin-left: 10px" type="reset" name="reset" value="Reset">
            </div>
        </fieldset>
        <div class="viewMessae" style="text-align: center">
            <?php
            if (isset($myMessage)) {
                foreach ($myMessage as $key => $message) {
                    if ($message == "saveOK") {
                        echo '<span style="color:red;font-weight:bold">Lưu thành công</span><br/>';
                    } else if ($message == "saveError") {
                        echo '<span style="color:red;font-weight:bold">Quá trình lưu bị lỗi</span><br/>';
                    } else {
                        echo "Lỗi ở" . $message;
                    }
                }
            }
            ?>
        </div>
        <?php echo $this->form()->closeTag($form); ?>
    </div>
</div>
